package com.jhgsys.internal.workflow.service;

import com.jhgsys.internal.common.exception.FebsException;
import com.jhgsys.internal.workflow.dto.WorkflowApplyDto;
import com.jhgsys.internal.workflow.dto.WorkflowReviewRequestDto;
import com.jhgsys.internal.workflow.entity.WorkflowApply;
import com.jhgsys.internal.common.entity.QueryRequest;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 流程申请表 Service接口
 *
 * @author fenghaijun
 * @date 2024-07-19 13:53:28
 */
public interface IWorkflowApplyService extends IService<WorkflowApply> {
    /**
     * 查询（分页）
     * @author fenghaijun
     * @date 2024-07-19 13:53:28
     * @param request QueryRequest
     * @param workflowApply workflowApply
     * @return IPage<WorkflowApply>
     */
    IPage<WorkflowApply> findWorkflowApplys(QueryRequest request, WorkflowApply workflowApply);

    /**
     * 查询（所有）
     * @author fenghaijun
     * @date 2024-07-19 13:53:28
     * @param workflowApply workflowApply
     * @return List<WorkflowApply>
     */
    List<WorkflowApply> findWorkflowApplys(WorkflowApply workflowApply);

    /**
    * 根据ID查询
    * @author fenghaijun
    * @date 2024-07-19 13:53:28
    * @param id
    * @return WorkflowApply
    */
    WorkflowApply findWorkflowApplyById(String id);

    /**
     * 逻辑删除
     * @author fenghaijun
     * @date 2024-07-19 13:53:28
     * @param workflowApply workflowApply
     * @param workflowApplyIds workflowApplyIds
     */
    void deleteWorkflowApply(WorkflowApply workflowApply,String workflowApplyIds);

    /**
    * 物理删除
    * @author fenghaijun
    * @date 2024-07-19 13:53:28
    * @param workflowApplyIds workflowApplyIds
    */
    void physicallyDeleteWorkflowApply(String workflowApplyIds);

    /**
     * 保存流程申请
     *
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    String saveWorkflowApply(WorkflowApply workflowApply, String userName, String realNMame) throws FebsException;

    /**
     * 流程审核
     * @param workflowReviewRequestDto 流程审核入参
     */
    @Transactional(rollbackFor = Exception.class)
    boolean submitWorkflowReview(WorkflowReviewRequestDto workflowReviewRequestDto) throws FebsException;

    /**
     * 关联查询违章记分（分页）
     * @author gy
     * @date 2024-09-12 13:53:28
     * @param request QueryRequest
     * @param workflowApply workflowApply
     * @return IPage<WorkflowApply>
     */
    IPage<WorkflowApplyDto> findApplyAndPeccancy(QueryRequest request, WorkflowApplyDto workflowApply);
}
